//  不要给我WA WA 叫
//  一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#define int long long 
using namespace std;
const int N = 1e6 + 10;
int a[N];
int n,k;
int find(int x)
{
    int l = 1;
    int r = n;
    while(l < r)
    {
        int mid = l + (r - l) / 2;
        if(a[mid] >= x)  r = mid;
        else l = mid + 1;
    }
    if(a[l] == x) return l;
    else return -1;
}
void solve()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++)  cin >> a[i];
    for(int i = 1; i <= k; i++)
    {
        int q;
        cin >> q;
        int ans = find(q);
        cout << ans << " ";
    }
   // cout << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    while(t -- )  solve();
    return 0;
}